import CustomTag from "@/components/CustomTag";
import { View } from "@tarojs/components";
import { Button, InfiniteLoading } from "@nutui/nutui-react-taro";
import useTaskcenter from "./hooks/useTaskcenter";
import "./index.scss";

const TaskCenter = () => {
  const { list, hasMore, onHandleRefresh, onHandleLoadMore, showDetail } =
    useTaskcenter();

  return (
    <View className="task_center">
      {/* <CustomTag kind={1}>任务中心</CustomTag> */}
      <View style={{ height: "200px", overflowY: "auto" }}>
        <InfiniteLoading
          target="scroll"
          pullRefresh
          pullingText={<>松开刷新</>}
          loadingText={<>加载中</>}
          loadMoreText={<>没有更多了</>}
          onRefresh={onHandleRefresh}
          hasMore={hasMore}
          onLoadMore={onHandleLoadMore}
        >
          {list.map((item, index) => {
            return (
              <li key={index} onClick={() => showDetail(item)}>
                {item}
              </li>
            );
          })}
        </InfiniteLoading>
      </View>
    </View>
  );
};

export default TaskCenter;
